From 363d0c33a47a3de21a64366870988bb995128a08 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Mon, 23 Jan 2006 10:46:02 +0000 Subject: [PATCH] move destruction of the private GdkGC from finalize() to unrealize(). 2006-01-23 Michael Natterer * gtk/gtkcolorbutton.c: move destruction of the private GdkGC from finalize() to unrealize(). Fixes BadMatch on display change (bug #85715). --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ gtk/gtkcolorbutton.c | 18 ++++++++++++++---- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c5bce98c2f..8f1cb62f3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-01-23 Michael Natterer + + * gtk/gtkcolorbutton.c: move destruction of the private GdkGC + from finalize() to unrealize(). Fixes BadMatch on display change + (bug #85715). + 2006-01-22 Kristian Rietveld * gtk/gtktreeview.c (gtk_tree_view_bin_expose): Revert previous diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index c5bce98c2f..8f1cb62f3b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2006-01-23 Michael Natterer + + * gtk/gtkcolorbutton.c: move destruction of the private GdkGC + from finalize() to unrealize(). Fixes BadMatch on display change + (bug #85715). + 2006-01-22 Kristian Rietveld * gtk/gtktreeview.c (gtk_tree_view_bin_expose): Revert previous diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c index 1dc8d6de05..a346c1d5de 100644 --- a/gtk/gtkcolorbutton.c +++ b/gtk/gtkcolorbutton.c @@ -103,6 +103,7 @@ static void gtk_color_button_get_property (GObject *object, /* gtkwidget signals */ static void gtk_color_button_realize (GtkWidget *widget); +static void gtk_color_button_unrealize (GtkWidget *widget); static void gtk_color_button_state_changed (GtkWidget *widget, GtkStateType previous_state); static void gtk_color_button_style_set (GtkWidget *widget, @@ -184,6 +185,7 @@ gtk_color_button_class_init (GtkColorButtonClass *klass) gobject_class->finalize = gtk_color_button_finalize; widget_class->state_changed = gtk_color_button_state_changed; widget_class->realize = gtk_color_button_realize; + widget_class->unrealize = gtk_color_button_unrealize; widget_class->style_set = gtk_color_button_style_set; button_class->clicked = gtk_color_button_clicked; klass->color_set = NULL; @@ -412,6 +414,18 @@ gtk_color_button_realize (GtkWidget *widget) render (color_button); } +static void +gtk_color_button_unrealize (GtkWidget *widget) +{ + GtkColorButton *color_button = GTK_COLOR_BUTTON (widget); + + if (color_button->priv->gc) + g_object_unref (color_button->priv->gc); + color_button->priv->gc = NULL; + + GTK_WIDGET_CLASS (parent_class)->unrealize (widget); +} + static void gtk_color_button_style_set (GtkWidget *widget, GtkStyle *previous_style) @@ -614,10 +628,6 @@ gtk_color_button_finalize (GObject *object) { GtkColorButton *color_button = GTK_COLOR_BUTTON (object); - if (color_button->priv->gc != NULL) - g_object_unref (color_button->priv->gc); - color_button->priv->gc = NULL; - if (color_button->priv->cs_dialog != NULL) gtk_widget_destroy (color_button->priv->cs_dialog); color_button->priv->cs_dialog = NULL; -- 2.30.2